<template>
  <div class="consultation-pet-view">
    <div class="avatar clearfix">
      <img :src="petInfo.avatarImg ? petInfo.avatarImg : 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3448484253,3685836170&fm=27&gp=0.jpg'" alt="">
      <div>
        <p class="name">{{petInfo.name}}</p>
        <p class="other">宠物生日：{{petInfo.brithday}}</p>
        <p class="other">{{showPetType(petInfo.type)}}</p>
      </div>
    </div>
    <p class="mtitle"><i class="el-icon-tickets"></i> 宠物基本信息</p>
    <div class="item">
      <div class="label">性别</div>
      <div class="text">{{petInfo.sex ? '雄' : '雌'}}</div>
    </div>
    <div class="item">
      <div class="label">体重</div>
      <div class="text">{{petInfo.weight}}</div>
    </div>
    <div class="item">
      <div class="label">绝育</div>
      <div class="text">{{petInfo.isSterile ? '是' : '否'}}</div>
    </div>
    <div class="item">
      <div class="label">免疫完善</div>
      <div class="text">{{petInfo.isImmune ? '是' : '否'}}</div>
    </div>
    <div class="item">
      <div class="label">体外驱虫</div>
      <div class="text">{{petInfo.inVitroDeworming}}</div>
    </div>
    <div class="item">
      <div class="label">体内驱虫</div>
      <div class="text">{{petInfo.inVivoDeworming}}</div>
    </div>
    <div class="item">
      <el-button type="text" size="mini" @click="dialogPetVisible = true">查看详情</el-button>
    </div>
    <p class="mtitle"><i class="el-icon-tickets"></i> 提问基本信息</p>
    <div class="item">
      <div class="label">精神</div>
      <div class="text">{{consultationInfo.diseaseInfo.vitality}}</div>
    </div>
    <div class="item">
      <div class="label">食物类别</div>
      <div class="text">{{consultationInfo.diseaseInfo.foodType}}</div>
    </div>
    <div class="item">
      <div class="label">食物描述</div>
      <div class="text">{{consultationInfo.diseaseInfo.foodDesc}}</div>
    </div>
    <div class="item">
      <div class="label">食欲</div>
      <div class="text">{{consultationInfo.diseaseInfo.appetite}}</div>
    </div>
    <div class="item">
      <div class="label">大便</div>
      <div class="text">{{consultationInfo.diseaseInfo.stool}}</div>
    </div>
    <div class="item">
      <div class="label">小便</div>
      <div class="text">{{consultationInfo.diseaseInfo.urinate}}</div>
    </div>
    <div class="item">
      <div class="label">病史</div>
      <div class="text">{{consultationInfo.diseaseInfo.hasMedicalHistory ? '有' : '无'}}</div>
    </div>    
    <el-dialog title="宠物档案"
      width="80%"
      :visible.sync="dialogPetVisible">
      <PetDetail :petId="petInfo.id"/>
    </el-dialog>
  </div>
</template>

<script>
import PetDetail from '@/components/pet/Detail.vue'

export default {
  name: 'Info',
  data() {
    return {
      dialogPetVisible: false
    }
  },
  props: [
    'petInfo',
    'consultationInfo'
  ],
  components: {
    PetDetail
  },
  methods: {
    showPetType(type) {
      if(type){
        return type[type.length-1];
      }
    },
  }
}
</script>
